import { mergeConfig } from 'vite';
import eslint from 'vite-plugin-eslint';
import baseConfig from './vite.config.base';

export default mergeConfig(
  {
    mode: 'development',
    server: {
      host: '0.0.0.0',
      open: true,
      fs: {
        strict: true,
      },

      // proxy代理
      proxy: {
        '/base': {
          target: 'http://223.68.159.190:48101',
          // target: 'http://10.0.20.250:8101',
          changeOrigin: true,
          rewrite: (path: string) => path.replace(/^\/base/, ''),
        },

        '/sortSys': {
          // 测试环境
          target: 'http://192.168.50.145:8101',
          // target: 'http://172.17.101.150:8080',
          // target: 'http://192.168.50.220:8101',
          // 世博
          // target: 'http://192.168.50.192:8101',
          // yyf
          // target: 'http://192.168.50.68:8101',
          // 薛拯
          // target: 'http://192.168.50.210:8101',

          changeOrigin: true,
          rewrite: (path: string) => path.replace(/^\/api/, ''),
        },
        '/les': {
          // 测试环境
          target: 'http://192.168.50.145:8102',
          // target: 'http://172.17.101.24:8081',
          // 世博
          // target: 'http://192.168.50.192:8102',
          // yyf
          // target: 'http://192.168.50.68:8102',
          // 薛拯
          // target: 'http://192.168.50.210:8102',
          //王志真
          // target: 'http://192.168.50.220:8102',
          // 郑世波
          // target: 'http://192.168.50.192:8102',
          changeOrigin: true,
          rewrite: (path: string) => path.replace(/^\/api/, ''),
        },
      },
    },
    plugins: [
      eslint({
        cache: false,
        include: ['src/**/*.ts', 'src/**/*.tsx', 'src/**/*.vue'],
        exclude: ['node_modules'],
      }),
    ],
  },
  baseConfig
);
